import {lazy} from 'react'

const Home = lazy(()=>import("../page/Home"))
const Cart = lazy(()=>import("../page/Cart"))
const Cate = lazy(()=>import("../page/Cate"))
const Uncenter = lazy(()=>import("../page/Uncenter"))
const GoodsList = lazy(()=>import("../page/GoodsList"))
const GoodsDetail = lazy(()=>import("../page/GoodsDetail"))
const Reg = lazy(()=>import("../page/Reg"))
const Login = lazy(()=>import("../page/Login"))
const Coupon = lazy(()=>import("../page/Coupon"))

const rules=[
    {
        path: "/coupon",
        component: Coupon,
        exact: false,
        meta: {
            mustLogin: true,
            title: "优惠券"
        }
    },
    {
        path: "/login",
        component: Login,
        exact: false,
        meta: {
            mustLogin: false,
            title: "用户登录"
        }
    },
    {
        path: "/reg",
        component: Reg,
        exact: false,
        meta: {
            mustLogin: false,
            title: "用户注册"
        }
    },
    {
        path: "/goods_detail/",
        component: GoodsDetail,
        exact: false,
        meta: {
            mustLogin: false,
            title: "商品详情"
        }
    },
    {
        path: "/goods_list",
        component: GoodsList,
        exact: false,
        meta: {
            mustLogin: false,
            title: "商品列表"
        }
    },
    {
        path: "/",
        redirect: "/home",
        exact: true,
        meta: {
            mustLogin: false,
        }
    },
    {
        path: "/home",
        component: Home,
        exact: false,
        meta: {
            mustLogin: false,
            title: "小ushop"
        }
    },
    {
        path: "/cart",
        component: Cart,
        exact: false,
        meta: {
            mustLogin: true,
            title: "购物车"
        }
    },
    {
        path: "/cate",
        component: Cate,
        exact: false,
        meta: {
            mustLogin: false,
            title: "商品分类"
        }
    },
    {
        path: "/uncenter",
        component: Uncenter,
        exact: false,
        meta: {
            mustLogin: true,
            title: "个人中心"
        }
    }
]

export default rules
